<template>
	<view class="main"  style="width: 100%;">
		<view class="active_tit">
			<view class="tit">
				贷款用途
			</view> 
			<!-- <view class="add">
				＋
			</view> -->
		</view>
		<!-- input -->
		<ActiveForm required  ref='loanUse'>
			<view class="active_label">
				贷款用途：
			</view>
			<view class="active_input">
				
				<pikers :level='2' :value="loanUseText"  :options="options"  @change="((o)=>{form.loanUse=o.value.toString()})"    />
				
			</view>
		</ActiveForm>
		<view style="width: 100%;">
			<ActiveForm style="width: 100%;" required  ref='useDetail'>
				<view class="active_label">
					用途详述：
				</view>
				<view class="active_input">
					<textarea maxlength="60" style="width: 100%;font-size: 2.6rem;"  placeholder="录入上限60汉字" v-model="form.useDetail"  />
				</view>
			</ActiveForm>

		</view>

		
		
		
		
	</view>
</template>

<script>
	import SelectPicker from "../../SelectPicker";
	import pikers from "../../pikers.vue";
	import region from '../areaList.js'
	export default {
		name: 'activeForm',
		data() {
			return {
				region,
				province: "",
				city: "",
				county: "",
				index: 1,
				
				form: {
					loanUse:'',
					loanUse2:'',
					corCerttype: '',
					checked:''
				},
				options: [{
						label: "流动资金贷款",
						value: "10",
						children:[
							{label:' 购买成品、原材料',value:'11'},
							{label:'其他经营开支',value:'12'}
							
						]
					},
					{
						label: " 固定资产投资",
						value: "20",
						children:[
							{label:'购买机器、设备',value:'21'},
							{label:'购置经营性固定资产',value:'22'},
							{label:'新建工程',value:'23'},
							{label:'改造、装修工程',value:'24'},
						]
					},{
						label: " 其他",
						value: "30"
						
					},
				],
			}
		},
		computed:{
			loanUseText(){
				if(this.form.loanUse==null){
					let arr = ['10','11']
					this.form.loanUse = '10,11'
					return arr
				}else{
					let arr = this.form.loanUse.split(',')
					return arr
				}
			}
		},
		components: {
			SelectPicker,
			pikers
		},
		watch:{
			form:{
				handler:function(res){
					console.warn('loanUse组件数据变化',res)
					getApp().globalData.stdOffsurLoanBasic = Object.assign(getApp().globalData.stdOffsurLoanBasic, res)
				},
				deep:true
			}
		},
		mounted() {
			
			//获取返显数据
			setTimeout(()=>{
				//数据反显
				this.form = getApp().globalData.stdOffsurLoanBasic
			},getApp().globalData.timeout)
		},
		methods:{
			onConfirm(e){
				
				this.loanUseText = e.result
				this.form.loanUse = e.value.toString()
			
			},
			select(){
				this.$refs.linkage.show()
			}
		}
	}
</script>

<style lang="scss">
	
	
</style>

